package com.haojii.notifier.user;

import java.util.HashSet;
import java.util.Set;

import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.KeyFactory;

@PersistenceCapable(identityType=IdentityType.APPLICATION)
public class User {

	
	public User(String cellphone, String email) {
		super();
		this.cellphone = cellphone;
		this.email = email;
		
	}
	
	public User(com.google.appengine.api.users.User user, String cellphone) {
		super();
		this.user = user;
		this.cellphone = cellphone;
		this.email = user.getEmail();
	}
	
	
	@Persistent
	private com.google.appengine.api.users.User user;
	@Persistent
	private String cellphone;
	
	@Persistent
	private String notifierType;
	
	@PrimaryKey
	private String email;
	
	@Persistent
	private Set<Key> interestedEasytvEntities = new HashSet<Key>();
	
	
	public String getCellphone() {
		return cellphone;
	}

	public void setCellphone(String cellphone) {
		this.cellphone = cellphone;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public com.google.appengine.api.users.User getUser() {
		return user;
	}

	public void setUser(com.google.appengine.api.users.User user) {
		this.user = user;
	}

	public String getNotifierType() {
		return notifierType;
	}

	public void setNotifierType(String notifierType) {
		this.notifierType = notifierType;
	}
	
	
	
	public Key getKey()
	{
		return KeyFactory.createKey(User.class.getSimpleName(), email);
	}

	public Set<Key> getInterestedEasytvEntities() {
		return interestedEasytvEntities;
	}

	public void setInterestedEasytvEntities(Set<Key> interestedEasytvEntities) {
		this.interestedEasytvEntities = interestedEasytvEntities;
	}


}
